import axios from "../utils/http"
import store from "../store"

//mock
export function reqMockfetchPermission() {
    return axios.get("/api/permission?user=" + store.state.UserToken);
}

export function reqMocklogin(user) {
    return axios.get("/api/login?user=" + user)
}


//api
/* 登录 */
export const reqlogin = (user) => {
    console.log("666")
    return axios.post("/api/login", user)
}
/*获取权限 */
export const reqfetchPermission = () => {
    return axios.get("/api/permission?userType=admin")
}
/* 获取健康码信息 */
export const reqGetHealthInfo = (pageNum, pageSize) => {
    return axios.get(`/api/getUserHealthImg?pageNum=${pageNum}&pageSize=${pageSize}`)
}


/* 退出登录 */
export const reqLogout = () => {
    return axios.post("/api/logout")
}
/* 获取普通用户 */
export const reqgetAllUser = (pageNum,pageSize) => {
    return axios.get(`/api/user/getAllUser?pageNum=${pageNum}&pageSize=${pageSize}`)
}
/* 获取管理员用户 */
export const reqgetAdmin = () => {
    return axios.get("/api/user/getAllAdmin")
}
/* 删除用户 */
export const reqDelete = (id) => {
    return axios.delete(`/api/user/delete?id=${id}`)
}
/* 添加用户 */
export const reqAddUser = (user) => {
    return axios.post("/api/user/register",user)
}
export const reqGetImgByNickName=(nickName)=>{
    return axios.get(`/api/getUserHealthByNickName?nickName=${nickName}`)
}



